class Solution {
public:
    int hammingDistance(int x, int y) {
        int a = 1;
        int pre = 0;
        int suf = 0;
        int count = 0;
        for (int i = 0; i < 32; i++)
        {
            pre = x & (a << i);
            suf = y & (a << i);
            if (pre != suf)
            {
                count++;
            }
        }
        return count;
    }
};